<script setup lang="ts">
import { onMounted } from 'vue';
import { RouterView, useRoute } from 'vue-router'
import { useProductFileStore, useUserStore } from './stores';
import router from './router';
import { ElMessage } from 'element-plus';
import { FindFileService } from './service';
const route = useRoute()
const userStore = useUserStore()
const fileStore = useProductFileStore()
onMounted(() => {

  const info = localStorage.getItem("i18n_template_userinfo")
  if (!info || info == "undefined" || info == "null") {
    info && ElMessage({
      type: "warning",
      message: "请重新登录"
    })
    localStorage.removeItem("i18n_template_userinfo")
    router.push("/login?path="+route.fullPath)
    return
  } else {
    userStore.user = JSON.parse(info)
  }
  FindFileService('zh').then((res) => {
    console.log('res ', res)
    fileStore.FileInfos = res.data
  })
})
</script>
<template>
  <RouterView />
</template>

<style scoped></style>
